----------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/P
> osted/FPA Version/Work/Logs/Figure2Log.log
  log type:  text
 opened on:  25 Aug 2021, 10:37:21

. 
. cd "$path/Data/"
/Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/Posted/FPA Ver
> sion/Work/Data

. use "CCESUsable.dta"

. 
. set more off

. set scheme plotplain

. 
. * Adding labels to prettify outputs
. lab var cueCIA "CIA Treatment"

. lab var cueAgree "Agreement Treatment"

. lab var white "White"

. lab var college "College"

. lab var female "Female"

. lab var threatiran "Perception of Iranian Threat"

. lab var dem7 "Democrat"

. lab var gop7 "Republican"

. lab var ind7 "Independent"

. lab var age "Age in Years"

. 
. lab def cueAgreelab2 0 "Divided Endorsement" 1 "Supportive Endorsement"

. lab val cueAgree cueAgreelab2

. 
. lab def cueCIAlab 0 "Independent Experts" 1 "CIA Endorsement"

. lab val cueCIA cueCIAlab

. 
. * generating the cueIndependent variable to create a more intuitive way of 
. * interpreting the data
. 
. gen cueIndependent = .
(1,000 missing values generated)

. replace cueIndependent =1 if cueCIA == 0
(421 real changes made)

. replace cueIndependent =0 if cueCIA == 1
(453 real changes made)

. 
. lab def cueIndependentlab 0 "CIA Endorsement" 1 "Independent Endorsement"

. lab val cueIndependent cueIndependentlab

. 
. 
. ************************
. * Generating Figure 2
. ************************
. cd "$path/Charts/"
/Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/Posted/FPA Ver
> sion/Work/Charts

. 
. * running and storing the OLS regressions 
. 
. reg confidenceiran i.cueAgree##i.cueIndependent 

      Source |       SS           df       MS      Number of obs   =       597
-------------+----------------------------------   F(3, 593)       =     19.14
       Model |  366.081279         3  122.027093   Prob > F        =    0.0000
    Residual |  3781.51001       593  6.37691401   R-squared       =    0.0883
-------------+----------------------------------   Adj R-squared   =    0.0837
       Total |  4147.59129       596  6.95904579   Root MSE        =    2.5253

---------------------------------------------------------------------------------------
       confidenceiran |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
             cueAgree |
Supportive Endorse..  |   1.524458   .2819043     5.41   0.000     .9708061    2.078111
                      |
       cueIndependent |
Independent Endors..  |   .3181506   .2998767     1.06   0.289     -.270799    .9071001
                      |
             cueAgree#|
       cueIndependent |
Supportive Endorse.. #|
Independent Endors..  |   .0006683    .415183     0.00   0.999    -.8147398    .8160763
                      |
                _cons |   5.345912   .2002658    26.69   0.000     4.952595    5.739228
---------------------------------------------------------------------------------------

. eststo confidenceAllBase

. 
. reg confidenceiran i.cueAgree##i.cueIndependent college ///
>         age white threatiran female i.dem7 i.gop7

      Source |       SS           df       MS      Number of obs   =       491
-------------+----------------------------------   F(10, 480)      =     21.93
       Model |  1061.10756        10  106.110756   Prob > F        =    0.0000
    Residual |  2322.94132       480  4.83946108   R-squared       =    0.3136
-------------+----------------------------------   Adj R-squared   =    0.2993
       Total |  3384.04888       490   6.9062222   Root MSE        =    2.1999

---------------------------------------------------------------------------------------
       confidenceiran |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
             cueAgree |
Supportive Endorse..  |   1.712451   .2715289     6.31   0.000     1.178919    2.245983
                      |
       cueIndependent |
Independent Endors..  |   .0786708   .2905308     0.27   0.787    -.4921985      .64954
                      |
             cueAgree#|
       cueIndependent |
Supportive Endorse.. #|
Independent Endors..  |  -.0858826   .4016427    -0.21   0.831    -.8750778    .7033126
                      |
              college |   .0518375   .2075339     0.25   0.803    -.3559496    .4596247
                  age |   .0220708   .0064182     3.44   0.001     .0094595    .0346821
                white |   -.355065    .263839    -1.35   0.179    -.8734872    .1633571
           threatiran |   .0179779   .0062489     2.88   0.004     .0056995    .0302564
               female |   .1493853   .2070187     0.72   0.471    -.2573896    .5561601
               1.dem7 |  -.9660955   .3234509    -2.99   0.003     -1.60165   -.3305409
               1.gop7 |   1.112241   .3354958     3.32   0.001     .4530192    1.771463
                _cons |    4.50744     .46721     9.65   0.000      3.58941    5.425469
---------------------------------------------------------------------------------------

. eststo confidenceAllControls

. 
. reg confidenceiran i.cueAgree##i.cueIndependent college ///
>         age white threatiran female if dem7==1

      Source |       SS           df       MS      Number of obs   =       234
-------------+----------------------------------   F(8, 225)       =      7.89
       Model |  350.794192         8   43.849274   Prob > F        =    0.0000
    Residual |  1250.76564       225  5.55895839   R-squared       =    0.2190
-------------+----------------------------------   Adj R-squared   =    0.1913
       Total |  1601.55983       233  6.87364734   Root MSE        =    2.3577

---------------------------------------------------------------------------------------
       confidenceiran |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
             cueAgree |
Supportive Endorse..  |   1.916037   .4182241     4.58   0.000       1.0919    2.740174
                      |
       cueIndependent |
Independent Endors..  |  -.3832586   .4612901    -0.83   0.407     -1.29226    .5257428
                      |
             cueAgree#|
       cueIndependent |
Supportive Endorse.. #|
Independent Endors..  |    .763534   .6323008     1.21   0.228    -.4824548    2.009523
                      |
              college |  -.1022101   .3188533    -0.32   0.749    -.7305307    .5261106
                  age |   .0070797   .0099765     0.71   0.479    -.0125797     .026739
                white |   -.292646   .3654856    -0.80   0.424    -1.012858    .4275665
           threatiran |   .0297381   .0099261     3.00   0.003     .0101781     .049298
               female |  -.1805769   .3216688    -0.56   0.575    -.8144457    .4532918
                _cons |   4.438932   .6012101     7.38   0.000     3.254209    5.623654
---------------------------------------------------------------------------------------

. eststo confidenceDemControls

. 
. reg confidenceiran i.cueAgree##i.cueIndependent college ///
>         age white threatiran female if gop7==1

      Source |       SS           df       MS      Number of obs   =       196
-------------+----------------------------------   F(8, 187)       =      4.22
       Model |  115.192789         8  14.3990986   Prob > F        =    0.0001
    Residual |  637.557211       187  3.40939685   R-squared       =    0.1530
-------------+----------------------------------   Adj R-squared   =    0.1168
       Total |      752.75       195  3.86025641   Root MSE        =    1.8465

---------------------------------------------------------------------------------------
       confidenceiran |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
             cueAgree |
Supportive Endorse..  |   1.412109   .3767339     3.75   0.000      .668914    2.155303
                      |
       cueIndependent |
Independent Endors..  |   .2194785   .3776405     0.58   0.562    -.5255047    .9644617
                      |
             cueAgree#|
       cueIndependent |
Supportive Endorse.. #|
Independent Endors..  |  -.6957701   .5454948    -1.28   0.204    -1.771885    .3803444
                      |
              college |   .0076041   .2799318     0.03   0.978     -.544626    .5598343
                  age |   .0284565   .0088953     3.20   0.002     .0109085    .0460045
                white |   .2562657   .4766541     0.54   0.591    -.6840448    1.196576
           threatiran |   .0082308   .0084522     0.97   0.331    -.0084431    .0249047
               female |   .1523596   .2806282     0.54   0.588    -.4012444    .7059635
                _cons |   4.967786    .706638     7.03   0.000      3.57378    6.361793
---------------------------------------------------------------------------------------

. eststo confidenceGOPControls

. 
. reg confidenceiran i.cueAgree##i.cueIndependent college ///
>         age white threatiran female if ind7==1

      Source |       SS           df       MS      Number of obs   =        61
-------------+----------------------------------   F(8, 52)        =      3.71
       Model |   163.02241         8  20.3778012   Prob > F        =    0.0017
    Residual |  285.239885        52  5.48538241   R-squared       =    0.3637
-------------+----------------------------------   Adj R-squared   =    0.2658
       Total |  448.262295        60  7.47103825   Root MSE        =    2.3421

---------------------------------------------------------------------------------------
       confidenceiran |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
             cueAgree |
Supportive Endorse..  |   2.236942   .7886513     2.84   0.006     .6543977    3.819487
                      |
       cueIndependent |
Independent Endors..  |   1.029622   .9952147     1.03   0.306    -.9674223    3.026666
                      |
             cueAgree#|
       cueIndependent |
Supportive Endorse.. #|
Independent Endors..  |  -1.298183   1.314072    -0.99   0.328    -3.935061    1.338696
                      |
              college |   .6331849   .6947262     0.91   0.366    -.7608853    2.027255
                  age |   .0726042   .0194094     3.74   0.000     .0336563    .1115521
                white |  -.9884237   .7255658    -1.36   0.179    -2.444378    .4675306
           threatiran |   .0000306    .018957     0.00   0.999    -.0380095    .0380706
               female |   1.574937   .6476255     2.43   0.019     .2753817    2.874493
                _cons |   1.337238   1.157442     1.16   0.253     -.985339    3.659814
---------------------------------------------------------------------------------------

. eststo confidenceIndControls

. 
. * plotting the coefficients, all in one go
. 
. coefplot (confidenceAllControls, label(All) offset(.3)) ///
>         (confidenceDemControls, label(Democrats) offset(.15)) ///
>         (confidenceIndControls, label(Independents) ) ///
>         (confidenceGOPControls, label(Republicans) offset(-.15)), ///
>         title("Figure 2: Factors Influencing Confidence in Attribution of Cyberattack 
> to Iran") ///
>         subtitle("CCES 2018 Experiment; Selected OLS Coefficients Displayed", size(sma
> ll)) ///
>         drop(_cons female college age white threatiran *.dem7 *.gop7) coeflabels(,wrap
> (20)) ///
>         note("Full specification includes demographic controls as well as controls for
>  perception of Iranian threat.",size(vsmall)) ///
>         xline(0)

.         
. graph export "Figure 2.pdf", replace
(file /Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/Posted/F
> PA Version/Work/Charts/Figure 2.pdf written in PDF format)

. 
. * running and storing alternate OLS regressions (note "vulnerablepower", a 
. * measurement of whether R believes that power grids are vulnerable)
. 
. reg confidenceiran i.cueAgree##i.cueIndependent college ///
>         age white threatiran female vulnerablepower ///
>         i.dem7 i.gop7

      Source |       SS           df       MS      Number of obs   =       490
-------------+----------------------------------   F(11, 478)      =     19.86
       Model |  1060.39235        11  96.3993048   Prob > F        =    0.0000
    Residual |  2320.64642       478  4.85490884   R-squared       =    0.3136
-------------+----------------------------------   Adj R-squared   =    0.2978
       Total |  3381.03878       489  6.91418972   Root MSE        =    2.2034

---------------------------------------------------------------------------------------
       confidenceiran |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
             cueAgree |
Supportive Endorse..  |   1.716742    .272519     6.30   0.000     1.181259    2.252225
                      |
       cueIndependent |
Independent Endors..  |   .0868249   .2915953     0.30   0.766    -.4861421     .659792
                      |
             cueAgree#|
       cueIndependent |
Supportive Endorse.. #|
Independent Endors..  |   -.093511   .4026516    -0.23   0.816     -.884697    .6976749
                      |
              college |   .0633813   .2087226     0.30   0.762     -.346746    .4735085
                  age |   .0229472   .0066637     3.44   0.001     .0098534     .036041
                white |   -.356791   .2642798    -1.35   0.178    -.8760847    .1625028
           threatiran |   .0180867   .0062776     2.88   0.004     .0057516    .0304217
               female |   .1542676   .2084699     0.74   0.460     -.255363    .5638983
      vulnerablepower |   -.047087   .0933002    -0.50   0.614    -.2304162    .1362422
               1.dem7 |  -.9575148   .3244407    -2.95   0.003    -1.595021   -.3200084
               1.gop7 |   1.100379   .3364834     3.27   0.001     .4392097    1.761549
                _cons |    4.57354   .4878474     9.37   0.000      3.61495    5.532131
---------------------------------------------------------------------------------------

. eststo confidenceAllControls2

. 
. reg confidenceiran i.cueAgree##i.cueIndependent college ///
>         age white threatiran female vulnerablepower ///
>         if dem7==1

      Source |       SS           df       MS      Number of obs   =       234
-------------+----------------------------------   F(9, 224)       =      7.17
       Model |   358.08474         9  39.7871933   Prob > F        =    0.0000
    Residual |  1243.47509       224  5.55122808   R-squared       =    0.2236
-------------+----------------------------------   Adj R-squared   =    0.1924
       Total |  1601.55983       233  6.87364734   Root MSE        =    2.3561

---------------------------------------------------------------------------------------
       confidenceiran |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
             cueAgree |
Supportive Endorse..  |   1.935887    .418292     4.63   0.000     1.111596    2.760177
                      |
       cueIndependent |
Independent Endors..  |  -.3494637   .4619116    -0.76   0.450    -1.259712    .5607843
                      |
             cueAgree#|
       cueIndependent |
Supportive Endorse.. #|
Independent Endors..  |   .7302459   .6325283     1.15   0.250    -.5162214    1.976713
                      |
              college |  -.0790011   .3192745    -0.25   0.805     -.708167    .5501647
                  age |   .0093713   .0101682     0.92   0.358    -.0106661    .0294088
                white |  -.2854757   .3652849    -0.78   0.435     -1.00531    .4343587
           threatiran |   .0309116   .0099719     3.10   0.002     .0112609    .0505623
               female |  -.1677193   .3216408    -0.52   0.603    -.8015482    .4661096
      vulnerablepower |  -.1754314   .1530812    -1.15   0.253    -.4770948     .126232
                _cons |   4.769634   .6665012     7.16   0.000     3.456219    6.083049
---------------------------------------------------------------------------------------

. eststo confidenceDemControls2

. 
. reg confidenceiran i.cueAgree##i.cueIndependent college ///
>         age white threatiran female vulnerablepower ///
>         if gop7==1

      Source |       SS           df       MS      Number of obs   =       195
-------------+----------------------------------   F(9, 185)       =      3.74
       Model |    115.9186         9  12.8798445   Prob > F        =    0.0002
    Residual |  636.614733       185  3.44116072   R-squared       =    0.1540
-------------+----------------------------------   Adj R-squared   =    0.1129
       Total |  752.533333       194   3.8790378   Root MSE        =     1.855

---------------------------------------------------------------------------------------
       confidenceiran |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
             cueAgree |
Supportive Endorse..  |   1.419294   .3826282     3.71   0.000     .6644184     2.17417
                      |
       cueIndependent |
Independent Endors..  |   .2279922   .3841117     0.59   0.554    -.5298103    .9857948
                      |
             cueAgree#|
       cueIndependent |
Supportive Endorse.. #|
Independent Endors..  |  -.7035004   .5502232    -1.28   0.203    -1.789019    .3820183
                      |
              college |   .0196481   .2834064     0.07   0.945    -.5394758     .578772
                  age |   .0291059   .0094571     3.08   0.002     .0104483    .0477635
                white |   .2508895   .4789996     0.52   0.601    -.6941143    1.195893
           threatiran |     .00795   .0085086     0.93   0.351    -.0088364    .0247363
               female |   .1526183   .2876253     0.53   0.596     -.414829    .7200655
      vulnerablepower |   -.024654   .1207569    -0.20   0.838    -.2628917    .2135836
                _cons |   4.983377   .7218745     6.90   0.000     3.559212    6.407541
---------------------------------------------------------------------------------------

. eststo confidenceGOPControls2

. 
. reg confidenceiran i.cueAgree##i.cueIndependent college ///
>         age white threatiran female vulnerablepower ///
>         if ind7==1

      Source |       SS           df       MS      Number of obs   =        61
-------------+----------------------------------   F(9, 51)        =      3.25
       Model |  163.375424         9  18.1528249   Prob > F        =    0.0034
    Residual |  284.886871        51  5.58601707   R-squared       =    0.3645
-------------+----------------------------------   Adj R-squared   =    0.2523
       Total |  448.262295        60  7.47103825   Root MSE        =    2.3635

---------------------------------------------------------------------------------------
       confidenceiran |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
             cueAgree |
Supportive Endorse..  |   2.229174   .7964524     2.80   0.007     .6302294    3.828119
                      |
       cueIndependent |
Independent Endors..  |   1.001915   1.010332     0.99   0.326    -1.026411    3.030241
                      |
             cueAgree#|
       cueIndependent |
Supportive Endorse.. #|
Independent Endors..  |  -1.291362   1.326349    -0.97   0.335    -3.954118    1.371394
                      |
              college |   .6065236   .7090466     0.86   0.396    -.8169468    2.029994
                  age |   .0711333   .0204419     3.48   0.001     .0300944    .1121722
                white |  -.9846539   .7323447    -1.34   0.185    -2.454897    .4855895
           threatiran |  -.0007285    .019367    -0.04   0.970    -.0396094    .0381523
               female |   1.567867    .654144     2.40   0.020     .2546183    2.881116
      vulnerablepower |   .0716917   .2851832     0.25   0.803    -.5008374    .6442208
                _cons |   1.250387   1.218034     1.03   0.309    -1.194919    3.695693
---------------------------------------------------------------------------------------

. eststo confidenceIndControls2

. 
. 
. ************************************************
. * Generating Tables for Appendix
. ************************************************
. 
. cd "$path/Tables/"
/Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/Posted/FPA Ver
> sion/Work/Tables

. 
. esttab confidenceAllBase confidenceAllControls confidenceDemControls ///
>         confidenceIndControls confidenceGOPControls ///
>         using "CCES2018ExperimentAttributionOLSControls.tex", replace ///
>         title("CCES Experiment of OLS Models of Confidence in Attribution, v1") ///
>         label nobaselevels ///
>         mtitles("Base" "Controls" "Democrats" "Independents" "Republicans")
(output written to CCES2018ExperimentAttributionOLSControls.tex)

.         
. esttab confidenceAllBase confidenceAllControls2 confidenceDemControls2 ///
>         confidenceIndControls2 confidenceGOPControls2 ///
>         using "CCES2018ExperimentAttributionOLSControls2.tex", replace ///
>         title("CCES Experiment of OLS Models of Confidence in Attribution, v2") ///
>         label nobaselevels ///
>         mtitles("Base" "Controls" "Democrats" "Independents" "Republicans")
(output written to CCES2018ExperimentAttributionOLSControls2.tex)

. 
.         
. log close
      name:  <unnamed>
       log:  /Users/paulmusgrave/Dropbox/0001 Academic Projects/Ongoing/0148 The Cyber/P
> osted/FPA Version/Work/Logs/Figure2Log.log
  log type:  text
 closed on:  25 Aug 2021, 10:37:24
----------------------------------------------------------------------------------------
